package com.vhall.component.entity.export.dto;

import com.alibaba.fastjson.annotation.JSONField;
import com.vhall.component.plugin.common.utils.JsonUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.apache.commons.lang3.StringUtils;

/**
 * admin房间导出查询条件
 *
 * @author yuanzh
 * @date 2021/11/25
 */
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
public class AdminExportRoomQueryCondition extends AdminExportCommonQueryCondition {

    private static final long serialVersionUID = -8382522844359016568L;

    /**
     * 房间状态
     * 0=待直播 1=直播中 2=已结束
     */
    @JSONField(name = "option_status")
    private Integer optionStatus;

    /**
     * 转换查询json为查询对象
     *
     * @param queryCondition 查询条件
     * @return 查询对象
     */
    public static AdminExportRoomQueryCondition convertTo(String queryCondition) {
        if (StringUtils.isBlank(queryCondition)) {
            return null;
        }
        return JsonUtil.objectFromJSONString(queryCondition, AdminExportRoomQueryCondition.class);
    }

}
